import { useUserStore} from "../store/user";
import constants from "../utils/constants";
const userStore = useUserStore()
const header = {
    'Content-Type': 'application/json',
    'authentication': userStore.getUserToken
  }

function sendMsg(msg){
  console.log(msg);
  wx.request({
    url:constants.database + '/user/user/feedback',
    method:'POST',
    data:{
          message:msg
    },
    header:{
      'Content-Type': 'application/json',
      'authentication': userStore.getUserToken
    }
  })
}

function getMsgList(){
    return new Promise((resolve, reject) => {
        wx.request({
            url:constants.database + `/user/user/chart`,
            method:'GET',
            header: {
              'Content-Type': 'application/json',
              'authentication': userStore.getUserToken
            },
            success: (res) => {
                resolve(res); // 返回原始 res 对象
            }
        })
      });
}

export {
  sendMsg,
  getMsgList
}
